<?php

use think\migration\Migrator;
use think\migration\db\Column;

class AirQualityPollutantCompanyForecastDay extends Migrator
{
    public function up()
    {
        $table = $this->table('air_quality_pollutant_company_forecast_day');
        $table

            //step1:时间
            ->addColumn('predict_time', 'datetime', ['comment'=>'预报时间',])
            ->addColumn('publish_time', 'datetime', ['comment'=>'发布时间',])

            //step3:贡献度相关
            ->addColumn('contribution_name', 'string', ['comment'=>'贡献度的名称',])
            ->addColumn('contribution_value', 'float', ['comment'=>'贡献度的值',])

            //step3:行业工业和非工业
            ->addColumn('industry_id', 'integer', ['limit'=>2, 'comment'=>'行业ID,行业类型1工业2非工业',])

            //step:关联ID
            ->addColumn('region_id', 'integer', ['comment'=>'区域ID',])
            ->addColumn('station_id', 'integer', ['comment'=>'站点ID',])
            ->addColumn('company_id', 'integer', ['comment'=>'公司ID',])

            //step:系统时间
            ->addColumn('create_time', 'datetime', ['comment'=>'插入时间',])

            //注释
            ->setComment('空气质量 - 污染物CAMX - 公司预报（天） - MongoDB')

            //引擎
            ->setEngine('InnoDB')
            ->save();
    }

    public function down()
    {
        $this->table('air_quality_pollutant_company_forecast_day')->drop();
    }
}
